# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ryzenadj
pkgver=0.10.0
pkgrel=0
pkgdesc="Adjust power management settings for Ryzen Mobile Processors"
url="https://github.com/FlyGoat/RyzenAdj"
arch="x86_64"
license="LGPL-3.0-only"
makedepends="
	cmake
	pciutils-dev
	samurai
	"
source="https://github.com/FlyGoat/RyzenAdj/archive/v$pkgver/ryzenadj-$pkgver.tar.gz"
builddir="$srcdir/RyzenAdj-$pkgver"
options="!check"  # no tests provided

build() {
	local crossopts=
	if [ "$CBUILD" != "$CHOST" ]; then
		crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -G Ninja -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		$crossopts .
	cmake --build build
}

package() {
	install -D -m755 build/ryzenadj -t "$pkgdir"/usr/sbin/
}

sha512sums="
4066b77963540014b6910d7da0e6465555a063b526a050c222c6c462ecce8eca31aadeaeb35e14836d0251df22c35ccd440e155a4d8c35b25ad61fd34299a965  ryzenadj-0.10.0.tar.gz
"
